stylecontext: Factor out a function
authorBenjamin Otte <otte@redhat.com>
Sat, 11 Oct 2014 00:41:15 +0000 (02:41 +0200)
committerBenjamin Otte <otte@redhat.com>
Wed, 15 Oct 2014 15:08:47 +0000 (17:08 +0200)
gtk/gtkstylecontext.c

index 8ce68ef0b10d0844916cdef8fef13fc992f54da6..e48aedd88aac42a1f6d65a854f80531483ace150 100644 (file)
@@ -704,20 +704,12 @@ gtk_style_context_impl_get_property (GObject    *object,
     }
 }
 
-static GtkWidgetPath *
-create_query_path (GtkStyleContext *context,
-                   GtkStyleInfo    *info)
+static void
+style_info_add_to_widget_path (GtkStyleInfo  *info,
+                               GtkWidgetPath *path,
+                               guint          pos)
 {
-  GtkStyleContextPrivate *priv;
-  GtkWidgetPath *path;
-  guint i, pos, length;
-
-  priv = context->priv;
-  path = priv->widget ? _gtk_widget_create_path (priv->widget) : gtk_widget_path_copy (priv->widget_path);
-  length = gtk_widget_path_length (path);
-  if (length == 0)
-    return path;
-  pos = length - 1;
+  guint i;
 
   /* Set widget regions */
   for (i = 0; i < info->regions->len; i++)
@@ -744,6 +736,21 @@ G_GNUC_END_IGNORE_DEPRECATIONS
 
   /* Set widget state */
   gtk_widget_path_iter_set_state (path, pos, info->state_flags);
+}
+
+static GtkWidgetPath *
+create_query_path (GtkStyleContext *context,
+                   GtkStyleInfo    *info)
+{
+  GtkStyleContextPrivate *priv;
+  GtkWidgetPath *path;
+  guint length;
+
+  priv = context->priv;
+  path = priv->widget ? _gtk_widget_create_path (priv->widget) : gtk_widget_path_copy (priv->widget_path);
+  length = gtk_widget_path_length (path);
+  if (length > 0)
+    style_info_add_to_widget_path (info, path, length - 1);
 
   return path;
 }